﻿using System;
namespace caculate;
class Caculator
{    
    int getMaxvalue(int[] array)
    {
        int max = array[0];
        for(int i = 1; i <array.Length; i++)
        {
            if (array[i] > max)
            {                
                max= array[i];
                
            }

        }
        return max;
    }
    int getMinvalue(int[] array)
    {
        int min = array[0];
        for (int i = 1; i < array.Length; i++)
        {
            if (array[i] < min)
            {
                min = array[i];
            }

        }
        return min;
    }
    int  getSum(int[] array)
    {
        int sum = 0;
        for (int i = 0; i < array.Length; i++)
        {
            sum += array[i];
        }
        
        return sum;
    }
    double getAverage(int[] array)
    {
        return getSum(array) /array.Length;
    }
    static void Main(String[] args)
    {
        int[] array = { 1, 3, 7, 9, 5,1 };
        Caculator c = new Caculator();  
        Console.WriteLine("该数组的最大值为" + c.getMaxvalue(array));
        Console.WriteLine("该数组的最小值为" + c.getMinvalue(array));
        Console.WriteLine("该数组的总和为" + c.getSum(array));
        Console.WriteLine("该数组的最小值为" + c.getAverage(array));
    }
}